【PaddleNLP No.20】Create ernie-3.0 deploy with paddle.inference & add training without hf#10475
Merged
luotao1 merged 1 commit intoPaddlePaddle:developfrom May 7, 2025
Merged
Conversation
|
Thanks for your contribution! |
There was a problem hiding this comment.
Pull Request Overview
This PR implements a Paddle Inference–based deploy for the Ernie‑3.0 model and introduces an alternative training script for NER when Hugging Face connectivity is unavailable.
- Adds a new script (run_token_cls_without_hf.py) for NER training without HF.
- Updates inference scripts (infer.py, token_cls_infer.py, seq_cls_infer.py) to leverage paddle.inference with new model file suffixes.
- Revises documentation in README files to reflect deployment changes.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| slm/model_zoo/ernie-3.0/run_token_cls_without_hf.py | Adds an alternative training script for NER. |
| slm/model_zoo/ernie-3.0/infer.py | Updates inference file paths to use new suffixes. |
| slm/model_zoo/ernie-3.0/deploy/python/token_cls_infer.py | Replaces fastdeploy with paddle.inference and adjusts preprocessing/postprocessing. |
| slm/model_zoo/ernie-3.0/deploy/python/seq_cls_infer.py | Updates prediction logic and removes fastdeploy dependencies. |
| slm/model_zoo/ernie-3.0/deploy/python/README.md | Revises usage examples to reflect updated inference arguments. |
| slm/model_zoo/ernie-3.0/README.md | Adds deploy instructions for infer.py and run_token_cls_without_hf.py. |
Comments suppressed due to low confidence (2)
slm/model_zoo/ernie-3.0/infer.py:190
- Ensure that args.model_path includes a trailing path separator or consider using os.path.join to construct the complete model file path, so that the concatenated file name is formed correctly.
model_file=args.model_path + f"model{PADDLE_INFERENCE_MODEL_SUFFIX}"
slm/model_zoo/ernie-3.0/deploy/python/token_cls_infer.py:100
- Verify that converting infer_data to a numpy array returns the expected shape; if the inference API now wraps the results differently compared to previous versions, you may need to adjust the postprocessing accordingly.
result = np.array(infer_data)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #10475 +/- ##
===========================================
- Coverage 48.99% 48.92% -0.07%
===========================================
Files 765 767 +2
Lines 125974 126238 +264
===========================================
+ Hits 61720 61766 +46
- Misses 64254 64472 +218 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR types
Function optimization
PR changes
Models
Description
slm/model_zoo/ernie-3.0/infer.py加入文档,并进行PIR适配;slm/model_zoo/ernie-3.0/run_token_cls_without_hf.py;slm/model_zoo/ernie-3.0/README.md;FastDeploy与paddle 3.0.0不适配的情况,重新实现基于paddle.inference的推理脚本,包括文本分类与NER两个任务;slm/model_zoo/ernie-3.0/deploy/python/seq_cls_infer.pyslm/model_zoo/ernie-3.0/deploy/python/token_cls_infer.pyslm/model_zoo/ernie-3.0/deploy/python/README.md。Issue: #9763
@DrownFish19